<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar" menu="cwgl.fkd"/>
    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="get_list(0);" data-id="0" class="yuCurrent">未付款</li>
                <li onclick="get_list(1);" data-id="1">已完成</li>
                <li onclick="get_list(2);" data-id="2">锁定</li>
                <li onclick="get_list(3);" data-id="3">作废</li>
            </ul>
        </div>
        <div class="live-seach">
            <ul class="clearfix receivables">
                <!--<li>-->
                    <!--<input id="order_no" type="text" value="" placeholder="拍单号" >-->
                <!--</li>-->
                <li>
                    <input id="car_no" type="text" value="" placeholder="车辆编号" >
                </li>
                <li>
                    <input id="payment_no" type="text" value="" placeholder="付款单号" >
                </li>
                <li>
                    <select id="pay_type">
                        <option value="">请选择付款类型</option>
                        <?php foreach($type_list as $tk=>$tv):?>
                        <option value="{$tk}">{$tv}</option>
                        <?php endforeach;?>
                    </select>
                </li>
                <li>
                    <select id="branch_id">
                        <?php if($branchId == 0):?>
                            <option value="-1">请选所属分公司</option>
                            <option value="0">总部</option>
                            <?php foreach($branchList as $bk=>$bv):?>
                                <option value="{$bv.id}">{$bv.name}</option>
                            <?php endforeach;?>
                        <?php else:?>
                          <option value="{$branchId}">{$branchName}</option>
                        <?php endif;?>
                    </select>
                </li>
                <!--<li>-->
                    <!--<input id="plate_number" type="text" value="" placeholder="车牌号" >-->
                <!--</li>-->
                <!--<li>-->
                    <!--<input type="text" id="demoText2" class="live-time" value="" placeholder="创建开始时间" readonly="">-->
                    <!--<i class="time-xian"></i>-->
                    <!--<input type="text" id="demoText3" class="live-time" value="" placeholder="创建结束时间" readonly="">-->
                <!--</li>-->
                <li class="collection ">
                    <input type="button" onclick="search()" value="搜索">
                </li>
            </ul>
        </div>
        <div class="yuList" >
            <div class="yunBei" style="display:none"></div>
            <div class="listBox" id="listBox"></div>
        </div>
        <div class="clear"></div>
    </div>
</div>
</body>
<script type="text/javascript">
    get_list(0);
    function get_list(t) {
        change_tabs(t);
        var url = get_url();
        $.get("/Payment/getList?t="+t, url, function (data) {
            $("#listBox").html(data);
        }, "html");
    }

    function get_page(p) {
        var t = $(".yuCurrent").attr("data-id");
        var url = get_url();
        url += "&p=" + p;
        $.get("/Payment/getList?t="+t, encodeURI(url), function (data) {
            $("#listBox").html(data);
        }, "html");
    }

    function search() {
        var t = $(".yuCurrent").attr("data-id");
        get_list(t);
    }

    function get_url(){
        var url = "";
        var order_no = $("#order_no").val();
        var car_no = $("#car_no").val();
        var pay_type = $("#pay_type").val();
        var payment_no = $("#payment_no").val()
//        var plate_number = $("#plate_number").val()
        var branch_id = $("#branch_id").val()
        if (order_no) {
            url += '&order_no=' + order_no;
        }
        if (car_no) {
            url += '&car_no=' + car_no;
        }
//        if(plate_number){
//            url += '&plate_number=' + plate_number;
//        }
        if(branch_id){
            url += '&branch_id=' + branch_id;
        }
        if (pay_type) {
            url += '&pay_type=' + pay_type;
        }
        if(payment_no){
            url += '&payment_no=' + payment_no;
        }
        return url;
    }

    function change_tabs(status){
        var current_t = $(".yuCurrent").attr("data-id");
        if(current_t != status){
            clear_form_params();
        }
    }

    function clear_form_params(){
        var branchId = $("#branch_id").val();
        $(':input').not(':button, :submit, :reset, :hidden').val('');

        if($("#branch_id option").length > 1){
            $("#branch_id").val(-1);
        }else {
            $("#branch_id").val(branchId);
        }
    }
</script>
<include file="Public/foot" >